import type { GiftItem } from '@/types/gift'
import type { PageResult, PageParams } from '@/types/global'
import type { ExchangeRecordItem, ExchangeRecordParams } from '@/types/exchangeRecord'
import { http } from '@/utils/http'
/**
 * 获取积分商品列表
 * @param data
 * @returns
 */
export const getPointsGiftAPI = (data: PageParams) => {
  return http<PageResult<GiftItem>>({
    method: 'GET',
    url: '/wechat/gift/list',
    data,
  })
}
/**
 * 获取兑换记录列表
 * @param data
 * @returns
 */
export const getExchangeRecordAPI = (data: ExchangeRecordParams) => {
  return http<PageResult<ExchangeRecordItem>>({
    method: 'GET',
    url: '/wechat/gift/record/list',
    data,
  })
}

/**
 * 添加提交兑换记录的API函数
 * @param data
 * @returns
 */
export const submitExchangeRecordAPI = (data: { giftId: number }) => {
  return http({
    method: 'POST',
    url: '/wechat/gift/record/add',
    data,
  })
}

/**
 * 添加修改兑换记录状态的API函数
 * @param data
 * @returns
 */
export const updateExchangeRecordStatusAPI = (data: { id: number; status: string }) => {
  return http({
    method: 'POST',
    url: '/wechat/gift/record/updateStatus',
    data,
  })
}
